package com.zhenyi.ayi.index;

import java.io.File;

import com.cenjiawen.common.IndexController;
import com.utils.image.UploadUtils;

public class ApiController extends IndexController {

	public void upload() {
		File file = getFileParam("file");

		if (!file.exists()) {
			renderMsg("文件不存在");
			return;
		}
		String url = UploadUtils.upload(file);
		if (url != null) {
			renderResult(url);
		} else {
			renderFailure("上传失败");
		}
	}

}
